﻿<template>
    <div id="_soso">
        <div class="layui-row layui-col-space15 clearfix">
            <div class="layui-col-md12">
                <div class="home-tips shadow" style="background:rgb(230, 230, 230);">
                    <div class="home-tips-container" style="    height: auto;">
                        <div class="demoTable">
                            <div class="layui-inline" style="width:70%">
                                <input class="layui-btn layui-btn-sm" type="text" name="search" id="search" placeholder="搜淘宝查券，输入宝贝标题" style="text-align: left;color: #009688; background-color: #fff;width:100%">
                            </div>
                            <button class="layui-btn layui-btn-sm" v-on:click="a_search()">查询</button>
                        </div>
                    </div>
                </div>
            </div>
            <!--左边文章列表-->
            <div class="layui-col-md8">

                <div class="left-box">
                    <p class="left-box-title shadow"><i class="fa fa-download fa-spin" aria-hidden="true"></i>最新搜索</p>

                    <div class="article shadow clearfix sr-listshow" v-for="n in taobao">
                        <div class="article-left">
                            <img :src="n.pict_url":alt="n.title" />
                        </div>
                        <div class="article-right">
                            <div class="article-title">
                                <a :href="n.url" target="_blank">{{n.title}}</a>
                            </div>
                            <div class="article-abstract">
                                <span style="color:red">￥{{n.zk_final_price}}</span>   佣金：{{n.commission_rate/100/2}}%
                                <a style="color:red" :href="n.coupon_share_url">  优惠券：{{n.coupon_info}}</a><br />
                                优惠券有效时间： {{n.coupon_start_time}}-{{n.coupon_end_time}}<br />
                                地址:{{n.provcity}}
                            </div>
                            <div class="article-footer">
                                <span class="layui-hide-xs"><i class="fa fa-tag" aria-hidden="true"></i>&nbsp;<a style="color:#009688" href="javascript:;">来自淘宝</a></span>
                                <a class="read layui-btn layui-btn-xs layui-btn-normal layui-hide-xs" :href="n.url" target="_blank" :title=" n.title">前往淘宝查看</a>
                            </div>
                        </div>
                        <div class="flag flag-left">淘宝网</div>
                    </div>

                    <div class="blog-pagebox">
                        <div id="newspage">

                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md4">
                <div class="layui-row layui-col-space10">

                    <div class="layui-col-sm6 layui-col-md12">
                        <div class="blog-card shadow sr-rightmodule">

                            <div class="layui-carousel" id="_news_taobao">
                                <div carousel-item="">

                                    <div v-for="pp in data">
                                        <a :href="pp.url" data-type="0" biz-itemid="null" data-tmpl="470x190" data-tmplid="635" data-rd="2" data-style="2" data-border="1" :title="pp.title" target="_blank">
                                            <img :src="pp.pict_url" style="width:100%;height:100%">
                                        </a>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>

                    <div class="layui-col-sm6 layui-col-md12">
                        <div class="blog-card shadow sr-rightmodule">
                            <div class="blog-card-title">
                                <span class="icon"><i class="layui-icon" aria-hidden="true">&#xe6c6;</i></span>
                                <span class="text">微信关注</span>
                            </div>
                            <ul class="blog-card-ul">
                                <li style="text-align: center;">
                                    <img src="/images/qrcode_for_gh_8044f5512351_258.jpg" />
                                </li>

                            </ul>
                        </div>
                    </div>
                    <div class="layui-col-sm6 layui-col-md12">
                        <div class="blog-card shadow sr-rightmodule">
                            <div class="blog-card-title">
                                <span class="icon"><i class="layui-icon" aria-hidden="true">&#xe6c6;</i></span>
                                <span class="text">磁力链接</span>
                            </div>
                            <ul class="blog-card-ul">
                                <li style="color:red">
                                    暂停不能下载
                                </li>

                            </ul>
                        </div>
                    </div>
                    <div class="layui-col-sm6 layui-col-md12">
                        <div class="blog-card shadow sr-rightmodule" data-scroll-reveal>
                            <div class="blog-card-title">
                                <span class="icon"><i class="layui-icon" aria-hidden="true">&#xe64c;</i></span>
                                <span class="text">推荐学习</span>
                            </div>
                            <ul class="blogroll">
                                <li><a target="_blank" href="http://www.layui.com/" title="layui官网">layui官网</a></li>
                                <li><a target="_blank" href="http://oa.asxsyd92.com/" title="net core 版OA系统">net core 版OA系统（正在开发）</a></li>
                            </ul>
                        </div>
                    </div>

                </div>
            </div>
        </div>  
 
    </div>

</template>
<script>
    var $ = null;
    layui.use(['layer', 'form', 'laypage', 'common'], function () {
        $ = layui.jquery; var laypage = layui.laypage, layer = layui.layer, _this, page = 1, limit = 15, ms, common = layui.common; carousel = layui.carousel; 
        closemuen();
        document.title = "优惠券|淘宝优惠|爱上歆随懿恫|淘券券|asxsyd92.com";
        module.exports = {
            name: "_taobao",
            data() {
                _this = this;
                if (common.getParamsUrl().query.key != null) { $("#search").val(common.getParamsUrl().query.key) }
                return {
                    data: [],
                    taobao: []
                }
            }
            , mounted: function () {
                var m = this;
                m.ajax();
                if (common.getParamsUrl().query.key != null) { $("#search").val(common.getParamsUrl().query.key) }
            },
            methods: {
                a_search: function (event) {
                    
                    this.ajax();
                },
                ajax: function () {
                    var m = this
                    var lay = layer.msg('正在拼命加载...', { icon: 16, shade: 0.5, time: 20000000 });
                    var t = $("#search").val();
                    fetch("/api/taobao/TaoBaoSearch?title=" + t + "&page=" + page + "&limit=12").then((data) => data.text()).then((data) => {
                        var my = JSON.parse(data);
                        layer.close(lay);
                        console.log(my);
                        this.taobao = my.data;
                        setTimeout(function () {

                            $('body,html').animate({ scrollTop: 0 }, 500);
                            gongdong();
                        }, 100);
                        //执行一个laypage实例
                        laypage.render({
                            elem: 'newspage' //注意，这里的 test1 是 ID，不用加 # 号
                            , count: my.count //数据总数，从服务端得到
                            , jump: function (obj, first) {

                                page = obj.curr;  //改变当前页码
                                limit = obj.limit;
                                //首次不执行
                                if (!first) {
                                    var t = $("#search").val();
                                    //do something
                                    fetch("/api/taobao/TaoBaoSearch?title=" + t + "&page=" + page + "&limit=" + limit).then((data) => data.text()).then((data) => {
                                        var my = JSON.parse(data);
                                        m.taobao = my.data;

                                        setTimeout(function () {

                                            $('body,html').animate({ scrollTop: 0 }, 500);
                                            gongdong();
                                        }, 100);
                                    });
                                }
                            }
                        });
                        this.taobao = my.data;
                    })
                    var sj = "";
                    if (this.data.length <= 0) {
                        fetch("/api/taobao/TaoBaoSearch?title=" + sj + "&page=" + 1 + "&limit=12").then((data) => data.text()).then((data) => {
                            var my = JSON.parse(data);
                            this.data = my.data;
                            setTimeout(function () {
                                //图片轮播
                                carousel.render({
                                    elem: '#_news_taobao'
                                    , width: '100%'
                                    , height: '350px'
                                    , interval: 5000
                                });
                            }, 500);
                        })
                    }
                }
            },
            created() {
                ms = this;
                  closemuen();
            }
        }
        function gongdong() {

            /msie[6 | 7 | 8 | 9]/i.test(navigator.userAgent) || (window.sr = new ScrollReveal({
                reset: !1
            }), sr.reveal(".sr-left", {
                origin: "left",
                scale: 1,
                opacity: .1,
                duration: 1200
            }), sr.reveal(".sr-bottom", {
                scale: 1,
                opacity: .1,
                distance: "60px",
                duration: 1e3
            }), sr.reveal(".sr-listshow", {
                distance: "30px",
                duration: 1e3,
                scale: 1,
                opacity: .1
            }), sr.reveal(".sr-rightmodule", {
                origin: "top",
                distance: "60px",
                duration: 1e3,
                scale: 1,
                opacity: .1
            }));
            layer.photos({
                photos: ".article-left",
                anim: 5
            });
            layer.photos({
                photos: ".article-detail-content",
                anim: 5,
                move: !1
            })

        }
    })
</script>
<style scoped>
</style>